package com.wish.housing.controller;

import com.wish.common.core.usconfig.common.MsgResult;
import com.wish.housing.entity.EsRoomInfo;
import com.wish.housing.es.EsRoomRinfoRepository;
import com.wish.housing.service.EsTbRoomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * @program: Wish-Cloud-master
 * @description:
 * @author: Mr.Wang
 * @create: 2022-03-29 15:43
 **/
@RestController
@RequestMapping("housinglist")
public class EsTbRoomInfoController {

	@Autowired
	EsTbRoomInfoService esTbRoomInfoService;
	@Autowired
	EsRoomRinfoRepository esRoomRinfoRepository;
	//全量同步es
	@GetMapping("eslist")
	public MsgResult eslist(EsRoomInfo roomInfo, @RequestParam(defaultValue = "1")Integer pageNum,@RequestParam(defaultValue = "10")Integer pageSize ){
		Page<EsRoomInfo> list = esTbRoomInfoService.list(roomInfo, pageNum, pageSize);
		return MsgResult.succeed(list);
	}

	@GetMapping("updateEs")
	public MsgResult updateEs(){
		esTbRoomInfoService.updateEs();
		return MsgResult.succeed();
	}


}
